@extends('front.common.header_bbs')

@section('title','我要发帖 - 青苜社区')

@section('head')
	 @parent
@stop


@section('content')
<link href="{{ asset('/css/bbs/posting.css') }}" rel="stylesheet" type="text/css">
<div class="posting-head">
	<div class="phead">
        <ul>
            <li class="first"><a href="/" target="_blank">首页</a></li>
            <li><span>|</span></li>
            <li><a href="{{ url('/bbs') }}" target="_self">青苜社区</a></li>
            <li><span>|</span></li>
            <li class="last">
                <a href="{{ url('/bbs') }}">我要发帖&nbsp;<i class="icon-remove c9"></i></a>
            </li>
        </ul>
	</div>
</div>
<div class="posting-body">
	<div class="pbody clearfix">
	    <form id="bbsForm" action="#">
		<div class="posting-left fl">
			<div class="psoting-left-t clearfix">
				<span class="psoting-plate">选择板块类型&nbsp;:</span>
				<div class="left-o float-l">
				    <input type="hidden" name="plate_first_id" value="@if(!empty($subcategory)){{$subcategory->parent_id}}@endif">
				    <input type="hidden" name="plate_child_id" value="@if(!empty($subcategory)){{$subcategory->id}}@endif">
                    <input type="hidden" name="questionid"     value="@if(!empty($quedetails)){{$quedetails->id}}@endif"">
                    <div class="dropdown float-l">
                      <button id="dLabel" type="button" class="bbs-post-down" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                           @if(empty($subcategory))
                              <div class="float-l" id="check_plate">请选择板块</div>
                           @else
                            @foreach($category as $key=>$cg)
                            @if($subcategory->parent_id == $cg->id )
                              <div class="float-l" id="check_plate">{{$cg->title}}</div>
                            @endif
                            @endforeach
                           @endif
                        <div class="float-r down-item-icon">
                            <i class="glyphicon glyphicon-triangle-bottom" id="nice-select" style="display: block;margin-top: 7px; margin-left: 10px;color: white"></i>
                        </div>
                      </button>
                      <ul class="dropdown-menu" aria-labelledby="dLabel">
                            @foreach($category as $key=>$cg)
                              <li><a href="javascript:void(0)" onclick="toCheckPlate('{{$cg->id}}','{{$cg->title}}')">{{$cg->title}}</a></li>
                            @endforeach
                      </ul>
                    </div>
                    <div class="dropdown float-l @if(empty($subcategory)) hide @endif" id="child-plate">
                      <button id="dLabel-child" type="button" class="bbs-post-down" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <div class="float-l" id="change_plate">
                            @if(empty($subcategory)) 请选择子板块 @else {{$subcategory->title}} @endif
                        </div>
                        <div class="float-r down-item-icon">
                            <i class="glyphicon glyphicon-triangle-bottom" id="nice-select" style="display: block;margin-top: 7px; margin-left: 10px;color: white"></i>
                        </div>
                      </button>
                      <ul class="dropdown-menu" aria-labelledby="dLabel-child" id="child-menu">
                          @if(!empty($subcategory))
                           @foreach($pcategory as $key=>$pcg)
                             <li><a href="javascript:void(0)" onclick="toChangePlate('{{$pcg->id}}','{{$pcg->title}}')">{{$pcg->title}}</a></li>
                           @endforeach
                          @endif
                      </ul>
                    </div>
                    <script type="text/javascript">
					$(function(){
                        $('#dLabel').dropdown();
                        $('#dLabel-child').dropdown();
					})
                    </script>
				</div>
			</div>
			<div class="psoting-left-fo">
				<input type="text" name="title" placeholder="请输入你的帖子标题" value="@if(!empty($quedetails)){{$quedetails->title}}@endif">
                <div class="editor">
<!--                     <textarea id='myEditor' name="detail" class=""></textarea> -->
                    <script id="detail" name="detail"  style="width:100%;margin:0 auto;height:300px;" type="text/plain">
                    </script>
                </div>
				<div class="psoting-left-footer fr" >
				    {!! csrf_field() !!}
					<a href="{{ url('/bbs') }}" class="abolish">取消</a>
					<button type="button" class="buttons fr" onclick="saveData('/bbs','bbsForm','')">立即发布</button>
				</div>
			</div>
		</div>
		</form>
		<div class="psoting-right fr">
			<div class="topic">
				<span>社区热帖</span>
				<div class="xsxs"></div>
                @foreach($hotpost as $key=>$hotp)
                    <p class="language">
                        <a href="{{url('/bbs/'.$hotp->id)}}">
                         {{str_limit($hotp->title,28)}}
                        </a>
                    </p>
                @endforeach
			</div>
		</div>
        <div class="clr"></div>
	</div>
</div>
<script type="text/javascript">
<!--
var ue = UE.getEditor('detail');
ue.ready(function() {
	ue.execCommand('serverparam', '_token', '{{ csrf_token() }}');//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值. 
	ue.setContent('@if(!empty($quedetails)) {!!$quedetails->detail !!} @endif');
});
//-->
</script>
@stop

<!--底部导航-->
@section('footer')
	@parent
@stop

